<?php
include_once("functions/db_manipulate.php");

if (!init()) {
    redirect("login.php");
}

$galleryResultSet = getAllGalleryImages();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Архив галереи - theFlyNet.com</title>

    <link rel="stylesheet" type="text/css" href="css/square.css">
    <link rel="stylesheet" type="text/css" href="css/menu.css">
    <link rel="stylesheet" type="text/css" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/gallery.css">
    <link rel="stylesheet" type="text/css" href="css/profile.css">
    <script src="resources/jquery.js"></script>

    <meta charset="UTF-8">
</head>

<body class="body">

<?php
include_once("menu.php");
$date = "";
?>

<div id="square">

    <div class="gallerydiv">


        <?php

        while ($gallery = mysql_fetch_assoc($galleryResultSet)) {
            if ($gallery['date'] != $date) {

                ?>
                <div class="galleryheader" style="margin-top: 40px;">
                    <?= $gallery['date'] ?>
                </div>
                <?php
                $date = $gallery['date'];
            }
            ?>

            <div class="archive_img" onclick="location.href='image.php?iid=<?= $gallery['id'] ?>'">
                <div class="archiveimg_info">
                    <div class="img_infotd">
                        #<?= $gallery['id'] ?>
                    </div>
                    <div class="img_infotd" style="text-align: right;">
                        <?= $gallery['date'] ?>
                    </div>
                    <div class="img_infotd" style="text-align: right;">
                        <?= $gallery['time'] ?>
                    </div>

                </div>

                <div class="archiveimg_header">
                    <?= $gallery['header'] ?>
                </div>

                <div class="archiveimg_content">
                    <?= getTextPart($gallery['comment'], 100) ?>
                </div>

            </div>

        <?php
        }
        ?>
    </div>

</div>

<?php
include_once("navigation.html");
?>

</body>
</html>
